<!DOCTYPE html>
<html>
<head>

<title>数据录入</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<link rel="stylesheet" href="css/bootstrap.min.css"></link>
<link rel="stylesheet" href="css/my.css"></link>
<link rel="stylesheet" href="css/bootstrap-datetimepicker.min.css">

<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/angular.min.js"></script>
<script src="js/bootstrap-datetimepicker.js"></script>
<script src="js/bootstrap-datetimepicker.zh-CN.js"></script>

<script src="js/head.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/logincheck.js"></script>

</head>

<body>
	<div id="headnav"></div>
	<div id="loginholder"></div>

	<div class="container-fluid">
		<form class="form-horizontal pecontent" role="form" id="proform">
			<fieldset>
				<div id="legend">
					<legend class="h1">生产数据信息录入：</legend>
				</div>

				<div class="form-group">
					<label for="prodate" class="col-sm-2 control-label">数据日期：</label>
					<div class="col-sm-10 ">
						<div class="col-sm-3" style="padding-left: 0px;">
							<input type="date" class="form-control datepicker" id="prodate" />
						</div>
					</div>
				</div>

				<div class="form-group">
					<label for="jiaci" class="col-sm-2 control-label">执行架次：</label>
					<div class="col-sm-4">
						<div class="col-sm-10" style="padding-left: 0px;">
							<input type="text" class="form-control" id="jiaci"
								placeholder="请输入执行架次">
						</div>
					</div>

					<label for="lvke" class="col-sm-2 control-label">旅客吞吐：</label>
					<div class="col-sm-4">
						<div class="col-sm-10" style="padding-left: 0px;">
							<input type="text" class="form-control" id="lvke"
								placeholder="请输入旅客吞吐量">
						</div>
					</div>
				</div>

				<div class="form-group">
					<label for="huoyou" class="col-sm-2 control-label">货邮吞吐：</label>
					<div class="col-sm-4">
						<div class="col-sm-10" style="padding-left: 0px;">
							<input type="text" class="form-control" id="huoyou"
								placeholder="请输入货邮吞吐量">
						</div>
					</div>

					<label for="fangxing" class="col-sm-2 control-label">正常放行：</label>
					<div class="col-sm-4">
						<div class="col-sm-10" style="padding-left: 0px;">
							<input type="text" class="form-control" id="fangxing"
								placeholder="请输入放行正常率">
						</div>
					</div>
				</div>

				<div class="control-group">
					<div class="controls" style="float: right;">
						<button class="btn btn-primary" type="button" id="clear"
							onclick="proclear()">清空</button>
						<button class="btn btn-primary" type="button" id="submit"
							onclick="prosubmit()">提交</button>
					</div>
				</div>

				<script type="text/javascript">
					function proclear() {
						$("#prodate").val('');
						$("#jiaci").val('');
						$("#lvke").val('');
						$("#huoyou").val('');
						$("#fangxing").val('');
					}

					function prosubmit() {
						var date = $("#prodate").val();
						var jiaci = $("#jiaci").val();
						var lvke = $("#lvke").val();
						var huoyou = $("#huoyou").val();
						var fangxing = $("#fangxing").val();

						if (date == "") {
							alert('日期不能为空!');
							return false;
						}
						if (jiaci == "") {
							alert('架次数据不能为空!');
							return false;
						}
						if (lvke == "") {
							alert('旅客数据不能为空!');
							return false;
						}
						if (huoyou == "") {
							alert('货邮数据不能为空!');
							return false;
						}
						if (fangxing == "") {
							alert('放行数据不能为空!');
							return false;
						}

						$.ajax({
							type : "POST",
							url : "productctrl",
							async : false,
							data : {
								"date" : date,
								"jiaci" : jiaci,
								"lvke" : lvke,
								"huoyou" : huoyou,
								"fangxing" : fangxing
							},
							dataType : "text",
							success : function(msg) {
								console.log('success');
								if (msg == '1') {
									alert("添加记录成功。");
									location.reload();
								} else {
									alert("添加记录失败。");
								}
							},
							error : function(data) {
								console.log('error');
								console.log(data);
							}
						});
					}
				</script>
			</fieldset>
		</form>
	</div>

	<div class="container-fluid">
		<form class="form-horizontal pecontent" role="form" id="pecform">
			<fieldset>
				<div id="legend">
					<legend class="h1">违规违章信息录入：</legend>
				</div>

				<div class="form-group">
					<label for="content" class="col-sm-2 control-label">违规违章内容：</label>
					<div class="col-sm-10 ">
						<textarea class="form-control" rows="4" id="content"></textarea>
					</div>
				</div>

				<div class="form-group">
					<label for="pecdate" class="col-sm-2 control-label">违规日期：</label>
					<div class="col-sm-10 ">
						<div class="col-sm-3" style="padding-left: 0px;">
							<input type="date" class="form-control datepicker" id="pecdate" />
						</div>
					</div>
				</div>

				<div class="form-group">
					<label for="personname" class="col-sm-2 control-label">提交者：</label>
					<div class="col-sm-10">
						<div class="col-sm-3" style="padding-left: 0px;">
							<input type="text" class="form-control" id="personname"
								placeholder="请输入姓名">
						</div>
					</div>
				</div>

				<div class="control-group">
					<div class="controls" style="float: right;">
						<button class="btn btn-primary" type="button" id="clear"
							onclick="pecclear()">清空</button>
						<button class="btn btn-primary" type="button" id="submit"
							onclick="pecsubmit()">提交</button>
					</div>
				</div>

				<script type="text/javascript">
					function pecclear() {
						$("#pecdate").val('');
						$("#content").val('');
						$("#personname").val('');
					}

					function pecsubmit() {
						var date = $("#pecdate").val();
						var content = $("#content").val();
						var person = $("#personname").val();

						if (date == "") {
							alert('日期不能为空!');
							return false;
						}
						if (content == "") {
							alert('内容不能为空!');
							return false;
						}
						if (person == "") {
							alert('提交人不能为空!');
							return false;
						}

						$.ajax({
							type : "POST",
							url : "peccancyctrl",
							async : false,
							data : {
								"date" : date,
								"content" : content,
								"person" : person
							},
							dataType : "json",
							success : function(msg) {
								console.log('success');
								if (msg == '1') {
									alert("添加记录成功。");
									location.reload();
								} else {
									alert("添加记录失败。");
								}

							},
							error : function(data) {
								//alert("error:"+data);
								location.reload();
							}
						});
					}
				</script>


			</fieldset>
		</form>
	</div>

</body>
</html>